#include<bits/stdc++.h> 

using namespace std;
#define int long long 
struct node{
	int life;
	int num;
};
signed main( )
{
	int n,k,time_cnt = 0;
	cin >> n >> k;
	vector<node> a(n);
	bool flag_k = 1;
	for(int i = 0; i < n ; ++i){
		cin >> a[i].life>>a[i].num;
	}
	for(int i = 0 ; i < n; ++i ){
		int temp_life = a[i].life ;
		int tm = a[i].num;
		while(tm != 0){
			if(temp_life == k+1 && flag_k ==1){
				time_cnt +=1;
			}
			else if(temp_life < k && flag_k == 1) {
				flag_k = 0;
				tm --;
				temp_life = a[i].life ;
			}else{
				temp_life-= 1;
				time_cnt  +=1;
				if(temp_life == 0) {
					flag_k = 1;
					tm --;
					temp_life = a[i].life ;
				}
			}
		}
		
	}
	cout << time_cnt ;
	return 0;
}
